package com.wude.guild.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.wude.guild.ChoujiangActivity;
import com.wude.guild.R;

/**
 * Created by Administrator on 2017/11/17 0017.
 */

public class PaySuccessDialog extends Dialog implements View.OnClickListener {
    private TextView tv_goChouJiang;//前往抽奖
    private Activity activity;
    private String phone;

    public PaySuccessDialog(@NonNull Context context, Activity activity, String phone) {
        super(context);
        this.activity = activity;
        this.phone = phone;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);// 去标题栏
        setContentView(R.layout.pay_success_dialog);
        Window window = this.getWindow();
        window.setBackgroundDrawableResource(R.color.transparency);
        window.getDecorView().setPadding(0, 0, 0, 0);
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;

        tv_goChouJiang = findViewById(R.id.tv_goChouJiang);

        tv_goChouJiang.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_goChouJiang:
                Intent intent = new Intent(activity, ChoujiangActivity.class);
                intent.putExtra("phone", phone);
                activity.startActivity(intent);
                activity.finish();
                break;
        }
    }

    @Override
    public void dismiss() {
        super.dismiss();
        activity.finish();
    }
}
